
package entity;

 
import ai_game.AIGame;
import org.newdawn.slick.geom.Rectangle;
import org.newdawn.slick.geom.Shape;
import org.newdawn.slick.geom.Vector2f;
import physics.CollisionClass;
import sprites.EntityAnimationInstance;

/**
 *
 * @author ant
 * 
 */
public class GameObject
{
    //physics
    public Vector2f pos = new Vector2f(), vel=new Vector2f();
    public Vector2f acc;
    public Shape collisionShape;
    public CollisionClass collisionClass;
    public double headingRadians;
    
    //rendering
    public EntityAnimationInstance animation;
    
    //other game info
    public double uuid;
    public boolean expired;
    
    public double[] feelWalls(double sideRayAngle, double distance)
    {
        double [] distances = new double[3];
        distances[0] = AIGame.game.physicsEngine.rayCast(pos, headingRadians - sideRayAngle, distance, this).distance;
        distances[1] = AIGame.game.physicsEngine.rayCast(pos, headingRadians, distance, this).distance;
        distances[2] = AIGame.game.physicsEngine.rayCast(pos, headingRadians + sideRayAngle, distance, this).distance;
        
        return distances;
    }
    
    public void render(Rectangle euclideanToRender)
    {
        if(animation != null)
            animation.render(euclideanToRender, pos);
        
    }
 
    public void setAccel(Vector2f accel)
    {
        acc = accel.copy();
    }
    
    public void stopAccel()
    {
        acc = null;
    }
    
    
     public void collide(GameObject other)
     {
         
     }
     
     public void update()
     {
//        if(collisionShape != null)
//        {
//            collisionShape.setCenterX(pos.x);
//            collisionShape.setCenterY(pos.y);
//        }
     }

    String string() {
        return "";
    }
}
